﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Innova.Entites;

namespace Innova.Repository.Mapp  
{
    public class PatrocinadorMap : EntityTypeConfiguration<PATROCINADOR>
    {
        public PatrocinadorMap()
        {
             // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.RUC)
                .IsRequired()
                .HasMaxLength(11);

            this.Property(t => t.RazonSocial)
                .IsRequired()
                .HasMaxLength(350);

            this.Property(t => t.Imagen)
                .HasColumnType("image");

            // Table & Column Mappings
            this.ToTable("PATROCINADOR");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.CategoriaId).HasColumnName("CategoriaId");
            this.Property(t => t.RUC).HasColumnName("RUC");
            this.Property(t => t.RazonSocial).HasColumnName("RazonSocial");
            this.Property(t => t.Imagen).HasColumnName("Imagen");
            
            // Relationships
            this.HasRequired(t => t.CATEGORIA)
                .WithMany(t => t.PRATROCINADORes)
                .HasForeignKey(d => d.CategoriaId);

        }
    }
}
